﻿package mortal.game.view.doubleHang
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import mortal.component.window.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.guide.*;
    import mortal.mvc.interfaces.*;

    public class DoubleHangWindow extends BaseWindow
    {
        protected var btnGoToHang:GLoadingButton;
        protected var btnFlyToHang:GLoadingButton;
        private static var _instance:DoubleHangWindow;

        public function DoubleHangWindow(param1:ILayer = null)
        {
            super(param1);
            setSize(386, 265);
            title = Language.getString(11703);
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.DoubleHangBg, 8, 36, this));
            this.btnGoToHang = UIFactory.gLoadingButton(ResFileConst.Xunluqianwang, 80, 214, 103, 38, this);
            this.btnFlyToHang = UIFactory.gLoadingButton(ResFileConst.Chuangsongqianwang, 209, 214, 103, 38, this);
            this.btnGoToHang.configEventListener(MouseEvent.CLICK, this.onClickGoToHang);
            this.btnFlyToHang.configEventListener(MouseEvent.CLICK, this.onClickFlyToHang);
            return;
        }// end function

        protected function onClickGoToHang(event:MouseEvent) : void
        {
            if (GuideAutoFightWin.instance.isHide)
            {
                GuideAutoFightWin.instance.show();
            }
            GuideAutoFightWin.instance.startWork(null, 600, 0, true);
            return;
        }// end function

        protected function onClickFlyToHang(event:MouseEvent) : void
        {
            if (GuideAutoFightWin.instance.isHide)
            {
                GuideAutoFightWin.instance.show();
            }
            GuideAutoFightWin.instance.startWork(null, 600, 1, true);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this.btnGoToHang.dispose();
            this.btnGoToHang = null;
            this.btnFlyToHang.dispose();
            this.btnFlyToHang = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public static function get instance() : DoubleHangWindow
        {
            if (!_instance)
            {
                _instance = new DoubleHangWindow;
            }
            return _instance;
        }// end function

    }
}
